package com.cysyz.springmvc.frame.controller;

import com.cysyz.web.modules.base.permission.domain.SysPrivilege;
import com.cysyz.web.modules.base.permission.service.PermissionService;
import com.cysyz.web.modules.base.support.SysConstants;
import com.cysyz.web.modules.base.support.controller.SpringMVCBaseController;
import com.cysyz.web.modules.base.user.domain.SysUser;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by jiaoyujia on 2015/1/20.
 */
@Controller()
@RequestMapping(FrameController.URL_PREFIX)
public class FrameController extends SpringMVCBaseController {
    public static final String URL_PREFIX = "/back/frame";
    @Resource
    PermissionService permissionService;

    @RequestMapping("/getFrame")
    public String frame() {
        SysUser currnetLoginUser = getSessionAttribute(SysUser.class, SysConstants.CURRENT_LOGIN_SYSUSER);
        List<SysPrivilege> allMenuOfUser = permissionService.findAllMenuOfUser(currnetLoginUser.getId());
        setRequestAttribute("menuInfo", allMenuOfUser);
        return "back/common/frame/frame";
    }

}
